#define _CRT_SECURE_NO_WARNINGS

#include	<stdio.h>
#include	<assert.h>

int binary_search(int* arr, int len, int findValve)
{
	assert(arr);
	int left = 0;
	int right = len - 1;
	int mid = 0;
	while (left <= right)
	{
		mid = left + ((right - left) >> 1);
		if (arr[mid] == findValve)
		{
			return mid;
		}
		else if (arr[mid] > findValve)
		{
			right = mid - 1;
		}
		else //if (arr[mid] < findValve)
		{
			left = mid + 1;
		}
	}
	return -1;
}

int main()
{
	int n = 0;
	int arr[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 };
	int sz = sizeof(arr) / sizeof(arr[0]);
	while (1)
	{
		scanf("%d",&n);
		printf("%d\n", binary_search(arr, sz, n));
	}
	return 0;
}